home *** CD-ROM | disk | FTP | other *** search
-
- page 60,132
- ;
- ; SET_CLIK : A program to set the key click count on the COMPAQ
- ;
- ; Tom Brengle (BRENGLE@LLL%LLL.MFE)
- ;
- ; Lawrence Livermore National Laboratory
- ; P. O. Box 5511, L-630
- ; Livermore, California 94550
- ;
- ; This program sets a parameter in the ROM BIOS data area of the COMPAQ
- ; which is used to determine the duration of the tone generated when a
- ; key is struck. The parameter is stored at 40:6A. A default value
- ; of 1 is set by the bootstrap code in the COMPAQ. A value of zero
- ; turns off the tone completely. A value of 70H generates a fairly loud
- ; tone, and larger values don't appreciably change it. SET_CLIK looks
- ; for a decimal number on the command line to store at 40:6A. If it
- ; doesn't find one, it stores the value set for the parameter DEFAULT.
- ;
- ; To build SET_CLIK :
- ;
- ; 1. Select a value for DEFAULT and assemble SET_CLIK.
- ;
- ; MASM SET_CLIK;
- ;
- ; 2. Link SET_CLIK;
- ;
- ; LINK SET_CLIK;
- ;
- ; 3. Convert SET_CLIK.EXE to SET_CLIK.COM;
- ;
- ; EXE2BIN SET_CLIK.EXE SET_CLIK.COM
- ;
- ;
- DEFAULT equ 1h ; Default value for the key click parameter.
- ; Zero turns off tone altogether.
- ; 70H generates about the loudest
- ; tone possible.
-
- ROM_BIOS_Data segment at 40h ; Locate the ROM BIOS data segment.
- org 6Ah
- Click_Count db
- ROM_BIOS_Data ends
-
- code_seg segment
- assume cs:code_seg
- org 80h
- Command_Line label byte ; Locate the command line buffer.
- org 100h
-
- Set_Clik proc near
- assume ds:ROM_BIOS_Data ; Set up ROM BIOS data segment.
- mov bx,ROM_BIOS_Data
- mov ds,bx
-
- call Get_Number ; See if there is an argument from
- ; the command line.
- jc Use_Default ; No, then use the default.
- mov Click_Count,al ; Yes, then use the input value,
- jmp Exit ; and exit.
-
- Use_Default:
- mov al,DEFAULT ; Store DEFAULT into Click_Count,
- mov Click_Count,al ; and exit.
-
- Exit: mov ah,0 ; Exit to DOS.
- int 21h
-
- Set_Clik endp
-
- ; Subroutine to get a decimal number from the command line :
- Get_Number proc near
- push ds ; Save some registers.
- push bx
- push cx
- push si
- push di
- assume ds:code_seg ; Set up the data segment to be the
- mov ax,cs ; code segment.
- mov ds,ax
-
- mov si,offset Command_Line+1 ; Set up an index to the
- ; command line buffer.
- mov cx,0 ; Check the command line buffer
- mov cl,Command_Line ; character count to see if an
- cmp cx,0 ; input value has been supplied.
- je No_Arg_Return ; If not, go store default value.
-
- mov bx,cx ; Set up to scan over leading spaces.
- mov al,20h
- mov byte ptr [bx+si],al
- mov di,si
- repe scasb ; Do the scan.
- cmp cx,0 ; If the count is now zero, there
- ; was nothing but spaces.
- jl No_Arg_Return ; In that case, go store default value.
-
- mov ax,0 ; Clear a register to accumulate the
- ; input value, digit by digit.
- mov bh,10 ; Set up multiply factor for decimal
- ; left-shift operation.
- dec di ; Back up pointer to first digit.
-
- Loop_on_Digits:
- mov bl,byte ptr [di] ; Get the next digit.
- sub bl,30h ; Convert it from ASCII.
- cmp bl,0h ; Check to see if it is in range.
- jl End_of_Digits ; If not, we are done.
- cmp bl,9h
- jg End_of_Digits
- mul bh ; Do a decimal left-shift on
- ; accumulated value.
- add al,bl ; Add in new digit.
- inc di ; Increment command line
- ; buffer pointer.
- jmp Loop_on_Digits ; Go back for next digit.
-
- End_of_Digits: ; Here if we found an input value.
- clc ; Clear error flag.
- jmp G_N_Return
-
- No_Arg_Return: ; Here if we didn't find one.
- stc ; Set error flag.
-
- G_N_Return:
- pop di ; Restore the registers.
- pop si
- pop cx
- pop bx
- pop ds
- ret ; And return.
- Get_Number endp
- code_seg ends
-
- end Set_Clik
-